package com.easymeeting.controller;

import java.util.List;

import com.easymeeting.entity.query.CmbcChargeCodeQuery;
import com.easymeeting.entity.po.CmbcChargeCode;
import com.easymeeting.entity.vo.ResponseVO;
import com.easymeeting.service.CmbcChargeCodeService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 民生银行缴款码 Controller
 */
@RestController("cmbcChargeCodeController")
@RequestMapping("/cmbcChargeCode")
public class CmbcChargeCodeController extends ABaseController{

	@Resource
	private CmbcChargeCodeService cmbcChargeCodeService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(CmbcChargeCodeQuery query){
		return getSuccessResponseVO(cmbcChargeCodeService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(CmbcChargeCode bean) {
		cmbcChargeCodeService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<CmbcChargeCode> listBean) {
		cmbcChargeCodeService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<CmbcChargeCode> listBean) {
		cmbcChargeCodeService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据ChargeCodeAndAppKey查询对象
	 */
	@RequestMapping("/getCmbcChargeCodeByChargeCodeAndAppKey")
	public ResponseVO getCmbcChargeCodeByChargeCodeAndAppKey(String chargeCode,String appKey) {
		return getSuccessResponseVO(cmbcChargeCodeService.getCmbcChargeCodeByChargeCodeAndAppKey(chargeCode,appKey));
	}

	/**
	 * 根据ChargeCodeAndAppKey修改对象
	 */
	@RequestMapping("/updateCmbcChargeCodeByChargeCodeAndAppKey")
	public ResponseVO updateCmbcChargeCodeByChargeCodeAndAppKey(CmbcChargeCode bean,String chargeCode,String appKey) {
		cmbcChargeCodeService.updateCmbcChargeCodeByChargeCodeAndAppKey(bean,chargeCode,appKey);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据ChargeCodeAndAppKey删除
	 */
	@RequestMapping("/deleteCmbcChargeCodeByChargeCodeAndAppKey")
	public ResponseVO deleteCmbcChargeCodeByChargeCodeAndAppKey(String chargeCode,String appKey) {
		cmbcChargeCodeService.deleteCmbcChargeCodeByChargeCodeAndAppKey(chargeCode,appKey);
		return getSuccessResponseVO(null);
	}
}